package com.hss.rxjava;

public class ObservableImpl<T> implements Observable<T> {

    public ObservableImpl(T t) {
        this.t = t;
    }

    T t;
    @Override
    public Observable<T> doNext(Action<T> action) {
        action.call(t);
        return this;
    }

    @Override
    public <R> Observable<R> map(Fun1<T, R> fun1) {
        return new ObservableImpl( fun1.call(t));
    }

    @Override
    public Disposable subscribe(Consumer<? super T> consumer) {
        try {
            consumer.accept(t);
        } catch (Exception e) {

        }
        return null;
    }


}
